/**
 * 
 */
package com.lmm.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author leiming
 *
 */
@WebServlet("/helloMavenWebapp")
public class HelloMavenWebappServlet extends HttpServlet {
	private static final long serialVersionUID = 8963265462953694987L;
	
	@Override
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String servletName = this.getServletName();
		System.out.println("servletName:"+servletName);
		//SpringServletContainerInitializer
		resp.getWriter().println("Get:/helloMavenWebapp");
		//RequestDispatcher d = req.getRequestDispatcher("/helloMavenWebapp/a");
		RequestDispatcher d =this.getServletContext().getNamedDispatcher("com.lmm.servlet.HelloMavenWebappServlet2");
		//RequestDispatcher d =this.getServletContext().getNamedDispatcher("jsp");
		d.include(req, resp);
	}

	@Override
	public void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.getWriter().println("Post:/helloMavenWebapp");
	}
}
